home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Windows
/
WindowObject.h
< prev
next >
Wrap
Text File
|
1997-06-28
|
4KB
|
129 lines
// WindowObject.h
#ifndef WindowObject_h
#define WindowObject_h
#ifndef __WINDOWS__
#include <Windows.h>
#endif
#ifndef ConstPString_h
#include "ConstPString.h"
#endif
#ifndef Str_h
#include "Str.h"
#endif
#ifndef PointObject_h
#include "PointObject.h"
#endif
#ifndef Rectangle_h
#include "Rectangle.h"
#endif
#ifndef GrafPortObject_h
#include "GrafPortObject.h"
#endif
class WindowObject: public WindowRecord
{
private:
// not implemented:
WindowObject( const WindowObject& );
void operator=( const WindowObject& );
WStateData& StateData();
const WStateData& StateData() const;
public:
enum Definition
{
noZoom = documentProc,
dialog = dBoxProc,
plain = plainDBox,
shadowed = altDBoxProc,
noGrowNoZoom = noGrowDocProc,
movableModal = movableDBoxProc,
document = zoomDocProc,
noGrow = zoomNoGrow,
rounded = rDocProc
};
WindowObject( Definition = document, bool withCloseBox = true );
~WindowObject() { CloseWindow( &port ); }
void Select() { SelectWindow( &port ); }
void SendBehind( WindowObject& w ) { ::SendBehind( &port, &w.port ); }
void SendToBack() { ::SendBehind( &port, 0 ); }
uint32 Index() const;
void SetIndex( uint32 );
void Show() { ShowWindow( &port ); }
void Hide() { HideWindow( &port ); }
void SetTitle( ConstPString s ) { SetWTitle( &port, s ); }
void GetTitle( String255& s ) const { GetWTitle( const_cast<WindowPtr>(&port), s ); }
PointObject Position() const { return Port().GlobalBounds().TopLeft(); }
void SetPosition( PointObject p ) { MoveWindow( &port, p.h, p.v, false ); }
void MoveByDragging( PointObject mouse ) { DragWindow( &port, mouse, &Rectangle::big ); }
PointObject Size() const { return Port().LocalBounds().Size(); }
void SetSize( PointObject size ) { SizeWindow( &port, size.h, size.v, true ); }
PointObject SizeByDragging( PointObject mouse,
PointObject minimum,
PointObject maximum );
Rectangle GlobalBounds() const { return Port().GlobalBounds(); }
void SetBounds( Rectangle );
Rectangle UserBounds() const { return StateData().userState; }
void SetUserBounds( Rectangle r ) { StateData().userState = r; }
Rectangle StandardBounds() const { return StateData().stdState; }
void SetStandardBounds( Rectangle r ) { StateData().stdState = r; }
bool TrackZoomInBox( PointObject mouse ) { return TrackBox( &port, mouse, inZoomIn ); }
bool TrackZoomOutBox( PointObject mouse ) { return TrackBox( &port, mouse, inZoomOut ); }
bool TrackCloseBox( PointObject mouse ) { return TrackGoAway( &port, mouse ); }
void ZoomToUserBounds();
void ZoomToStandardBounds();
Rectangle LocalBounds() const { return Port().LocalBounds(); }
uint32 RefCon() const { return GetWRefCon( const_cast<WindowPtr>( &port ) ); }
void SetRefCon( uint32 r ) { SetWRefCon( &port, r ); }
static WindowObject *Front() { return reinterpret_cast<WindowObject *>( FrontWindow() ); };
WindowObject *Next() { return static_cast<WindowObject *>( nextWindow ); }
GrafPortObject& Port() { return static_cast<GrafPortObject&>( port ); }
const GrafPortObject& Port() const { return static_cast<const GrafPortObject&>( port ); }
int16 Kind() const { return windowKind; }
bool Visible() const { return visible != 0; }
bool Highlighted() const { return hilited != 0; }
bool HasCloseBox() const { return goAwayFlag != 0; }
bool HasZoomBox() const { return spareFlag != 0; }
RgnHandle StructureRegion() const { return strucRgn; }
RgnHandle ContentRegion() const { return contRgn; }
RgnHandle InvalidRegion() const { return updateRgn; }
RgnHandle VisibleRegion() const { return port.visRgn; }
int16 TitleWidth() const { return titleWidth; }
ControlHandle FirstControl() const { return controlList; }
void SetVisibility( bool visible ) { ShowHide( &port, visible ); }
void SetHighlighting( bool highlighted ) { HiliteWindow( &port, highlighted ); }
GDHandle NearestScreen() const;
GDHandle DeepestScreen() const;
static uint32 CountVisibleWindows();
static uint32 CountVisibleWindows( Rectangle );
};
#endif